
#ifndef ICONANIMATION_H
#define ICONANIMATION_H

#include <QObject>

#include <QTimer>
#include <QList>
#include <QMap>
#include <QSet>
#include <QIcon>

class AbstractIconAnimator : public QObject
{
    Q_OBJECT
public:
    const int appendIcon(const QIcon &icon);
    const int appendIcon(const QString &fileName);

    const int appendIcons(const QStringList &fileNames);

    const bool isActive() const;

    void stop();
    void start();

protected:
    explicit AbstractIconAnimator(
        const unsigned short singleFrameDurationInMilliseconds = 100);

    virtual void setIcon(const QIcon &icon) const = 0;
    virtual const QIcon icon() const = 0;

protected slots:
    void me_timer_timeout();

protected:
    QList<QIcon> m_icons;
    uint m_index;

    QIcon m_backup;

    QTimer m_timer;
};



class QStandardItem;


class StandardItemIconAnimator : public AbstractIconAnimator
{
public:
    StandardItemIconAnimator(
        QStandardItem *item
    ,   const unsigned short singleFrameDurationInMilliseconds = 50);

protected:

    virtual void setIcon(const QIcon &icon) const;
    virtual const QIcon icon() const;

protected:
    QStandardItem *m_item;
};

#endif // ICONANIMATION_H
